package com.cskaoyan;

import com.cskaoyan.bean.Teacher;
import com.cskaoyan.bean.TeacherVO;
import com.cskaoyan.mapper.TeacherMapper;
import com.cskaoyan.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

import java.util.HashMap;
import java.util.List;
import java.util.Set;

/**
 * 创建日期: 2022/08/01 15:22
 *
 * @author ciggar
 */
public class MybatisMain {

    static SqlSession sqlSession;
    static TeacherMapper teacherMapper;

    static {
        sqlSession = MybatisUtils.getSqlSession(true);
        teacherMapper = sqlSession.getMapper(TeacherMapper.class);
    }

    public static void main1(String[] args) {

        String name = teacherMapper.selectNameById(6001);
        System.out.println(name);

    }

    public static void main2(String[] args) {
        Set<String> nameList = teacherMapper.selectNameList();

        System.out.println(nameList);
    }


    public static void main3(String[] args) {

        Teacher teacher = teacherMapper.selectTeacherById(6001);

        System.out.println(teacher);


    }

    public static void main4(String[] args) {

        TeacherVO teacherVO = teacherMapper.selectTeacherVOById(6001);

        System.out.println(teacherVO);

    }


    public static void main5(String[] args) {


        List<Teacher> teachers = teacherMapper.selectAll();

        System.out.println(teachers);

    }


    public static void main(String[] args) {

        TeacherVO teacherVO = teacherMapper.selectTeacherVOByIdUseResultMap(6003);

        System.out.println(teacherVO);


    }










}
